import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { Image } from "ant-design-vue";
//列表数据
export const columns : BasicColumn[] = [
	{
		title: '加入时间',
		align: "center",
		dataIndex: 'createtimeString'
	},
	{
		title: '状态',
		align: "center",
		dataIndex: 'stats',
		customRender:({text})=>{
			if(text=='Active')return '激活'
			if(text=='DisActive')return '冻结'
		}
	},
	{
		title: '昵称',
		align: "center",
		dataIndex: 'nickname'
	},
	{
		title: '手机号',
		align: "center",
		dataIndex: 'phone'
	},
	{
		title: '代号',
		align: "center",
		dataIndex: 'codename'
	},
	{
		title: '头像',
		align: "center",
		dataIndex: 'img',
		customRender: render.renderImage,
	},
	{
		title: '真实姓名',
		align: "center",
		dataIndex: 'realname'
	},

	{
		title: '领队标签',
		align: "center",
		dataIndex: 'guideTags_dictText'
	},
	{
		title: '微信号',
		align: "center",
		dataIndex: 'wchatnum',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.wchatnum || ''
		},

	},
	{
		title: '紧急联系人',
		align: "center",
		dataIndex: 'emergencyContact',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.emergencyContact || ''
		},
	},
	{
		title: '紧急联系人电话',
		align: "center",
		dataIndex: 'emergencyPhone',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.emergencyPhone || ''
		},
	},
	{
		title: '院系',
		align: "center",
		dataIndex: 'college',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.emergencyPhone || ''
		},
	},
	{
		title: '住址',
		align: "center",
		dataIndex: 'address',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.address || ''
		},
	},
	{
		title: '身份证号',
		align: "center",
		dataIndex: 'idnum'
	},
	{
		title: '身份证正面',
		align: "center",
		dataIndex: 'idCardA',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return render.renderImage({ text: extinfors.idCardA || '' })
		},
	},
	{
		title: '身份证反面',
		align: "center",
		dataIndex: 'idCardB',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return render.renderImage({ text: extinfors.idCardB || '' })
		},
	},
	{
		title: '导游证号',
		align: "center",
		dataIndex: 'guidnum'
	},
	{
		title: '导游证证件',
		align: "center",
		dataIndex: 'guideCertificate',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return  render.renderImage({ text: extinfors.guideCertificate || '' })
		},
	},
	{
		title: '对领队得工作了解',
		align: "center",
		dataIndex: 'aboutLeader',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.aboutLeader || ''
		},
	},
	{
		title: '对侣途得了解',
		align: "center",
		dataIndex: 'aboutTrip',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.aboutTrip || ''
		},
	},
	{
		title: '对旅游路线得了解',
		align: "center",
		dataIndex: 'aboutRout',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.aboutRout || ''
		},
	},
	{
		title: '自己组织或发生记忆深刻得事情',
		align: "center",
		dataIndex: 'introduceMyself',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.emergencyPhone || ''
		},
	},
	{
		title: '自我介绍',
		align: "center",
		dataIndex: 'aboutExp',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.aboutExp || ''
		},
	},
	{
		title: '自己评价',
		align: "center",
		dataIndex: 'selfEval',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.selfEval || ''
		},
	},
	{
		title: '领队等级',
		align: "center",
		sorter: true,
		dataIndex: 'levnum_dictText'
	},
	{
		title: '城市',
		align: "center",
		dataIndex: 'cityId_dictText',
		customRender: ({ text }) => {
			return render.renderCategoryTree(text, '')
		},
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId_dictText'
	},
	{
		title: '领队标签',
		align: "center",
		dataIndex: 'guideTags_dictText'
	},
	{
		title: '备注',
		align: "center",
		dataIndex: 'remark',
		customRender: ({ text, record }) => {
			if (!record.extInfors) return ''
			let extinfors = JSON.parse(record.extInfors)
			return extinfors.remark || ''
		},
	},

	{
		title: '性别',
		align: "center",
		dataIndex: 'sex_dictText'
	},
	{
		title: '年龄',
		align: "center",
		sorter: true,
		dataIndex: 'age'
	}
];
//查询数据
export const searchFormSchema : FormSchema[] = [
	{
		label: "昵称",
		field: "nickName",
		component: 'Input',
		//colProps: {span: 6},
	},
	{
		label: "手机号",
		field: "phone",
		component: 'Input',
		//colProps: {span: 6},
	},
	{
		label: "真实姓名",
		field: "realname",
		component: 'Input',
		//colProps: {span: 6},
	},
	{
		label: "租户",
		field: "tenantId",
		component: 'JSearchSelect',
		componentProps: {
			dict: "sys_tenant,name,id"
		},
		//colProps: {span: 6},
	},


	{
		label: "标签",
		field: "tags",
		component: 'JSelectMultiple',
		componentProps: {
			dictCode: "sys_category,name,id",
			triggerChange: true
		},
		//colProps: {span: 6},
	},
	{
		label: "备注",
		field: "remark",
		component: 'Input',
		//colProps: {span: 6},
	},

	{
		label: "领队标签",
		field: "guideTags",
		component: 'JSelectMultiple',
		componentProps: {
			dictCode: "sys_category,name,id,pid='1726775373183602689'",
			triggerChange: true
		},
		//colProps: {span: 6},
	},
	{
		label: "领队等级",
		field: "levnum",
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "sys_category,name,num,pid='1724609796876804098'"
		},
		//colProps: {span: 6},
	},
	{
		label: "性别",
		field: "sex",
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "sex"
		},
		//colProps: {span: 6},
	},

];

//表单数据
export const formSchema : FormSchema[] = [
	{
		label: '领队状态',
		field: 'stats',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "leader_stats"
		},
		required: true
	},
	{
		label: '手机号',
		field: 'phone',
		component: 'Input',
		required: true
	},
	{
		label: '真实姓名',
		field: 'realname',
		component: 'Input',
		required: true
	},
	{
		label: '代号',
		field: 'codename',
		component: 'Input',
		required: true
	},
	{
		label: '邮箱',
		field: 'email',
		component: 'Input',
		required: true
	},
	{
		label: '城市',
		field: 'cityId',
		component: 'JTreeDict',
		componentProps: { async: true, parentCode: 'A02' },
		required: true
	},
	{
		label: '学校',
		field: 'school',
		component: 'JSearchSelect',
		componentProps: {
			dict: "couple_school,title,id"
		},

	},
	{
		label: '备注',
		field: 'remark',
		component: 'InputTextArea',//TODO 注意string转换问题
	},

	{
		label: '领队标签',
		field: 'guideTags',
		component: 'JSelectMultiple',
		componentProps: {
			dictCode: "sys_category,name,id,pid='1726775373183602689'"
		},
		required: true
	},

	{
		label: '领队等级',
		field: 'levnum',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "sys_category,name,num,pid='1724609796876804098'"
		},
		required: true
	},
	{
		label: '性别',
		field: 'sex',
		component: 'JDictSelectTag',
		componentProps: {
			dictCode: "sex_new"
		},
	},
	{
		label: '年龄',
		field: 'age',
		component: 'InputNumber',
	},

	{
		label: '微信号',
		field: 'wchatnum',
		component: 'Input',//TODO 注意string转换问题
	},
	{
		label: '紧急联系人',
		field: 'emergencyContact',
		component: 'Input',//TODO 注意string转换问题
	},
	{
		label: '紧急联系人电话',
		field: 'emergencyPhone',
		component: 'Input',//TODO 注意string转换问题
	},
	{
		label: '院系',
		field: 'college',
		component: 'Input',//TODO 注意string转换问题
	},
	{
		label: '住址',
		field: 'address',
		component: 'Input',//TODO 注意string转换问题
	},
	{
		label: '身份证号',
		field: 'idnum',
		component: 'Input',//TODO 注意string转换问题
	},
	{
		label: '身份证正面',
		field: 'idCardA',
		component: 'JImageUpload',
	},
	{
		label: '身份证反面',
		field: 'idCardB',
		component: 'JImageUpload',
	},
	{
		label: '导游证号',
		field: 'guidnum',
		component: 'Input',//TODO 注意string转换问题
	},
	{
		label: '导游证证件',
		field: 'guideCertificate',
		component: 'JImageUpload',
	},
	{
		label: '对领队的工作了解',
		field: 'aboutLeader',
		component: 'InputTextArea',//TODO 注意string转换问题
	},
	{
		label: '对侣途的了解',
		field: 'aboutTrip',
		component: 'InputTextArea',//TODO 注意string转换问题
	},
	{
		label: '对旅游路线的了解',
		field: 'aboutRout',
		component: 'InputTextArea',//TODO 注意string转换问题
	},
	{
		label: '自己组织或发生记忆深刻得事情',
		field: 'introduceMyself',
		component: 'InputTextArea',//TODO 注意string转换问题
	},
	{
		label: '自我介绍',
		field: 'aboutExp',
		component: 'InputTextArea',//TODO 注意string转换问题
	},
	{
		label: '自我评价',
		field: 'selfEval',
		component: 'InputTextArea',//TODO 注意string转换问题
	},
	// TODO 主键隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];

//子表列表数据
export const coupleLeaderContractColumns : BasicColumn[] = [
	{
		title: '签订时间',
		align: "center",
		dataIndex: 'createTime'
	},
	{
		title: '签字',
		align: "center",
		dataIndex: 'signature',
		customRender: render.renderImage,
	},
	{
		title: '合同',
		align: "center",
		dataIndex: 'contractId_dictText'
	},
	{
		title: '签订的合同',
		align: "center",
		dataIndex: 'img',
		customRender: render.renderImage,
	},
	{
		title: '领队',
		align: "center",
		dataIndex: 'leaderId_dictText'
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId_dictText'
	},
];
//子表表单数据
export const coupleLeaderContractFormSchema : FormSchema[] = [
	// TODO 子表隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];
//子表列表数据
export const coupleUserFinanceColumns : BasicColumn[] = [
	{
		title: '可提现余额',
		align: "center",
		dataIndex: 'balance'
	},
	{
		title: '总佣金',
		align: "center",
		dataIndex: 'grossCommission'
	},
	{
		title: '已提现佣金',
		align: "center",
		dataIndex: 'yiCommission'
	},
	{
		title: '未提现佣金',
		align: "center",
		dataIndex: 'weiCommission'
	},
	{
		title: '总使用优惠券抵扣金额',
		align: "center",
		dataIndex: 'totalDiscountCoupon'
	},
	{
		title: '总支付金额',
		align: "center",
		dataIndex: 'totalSale'
	},
];
//子表表单数据
export const coupleUserFinanceFormSchema : FormSchema[] = [
	// TODO 子表隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];
//子表列表数据
export const coupleUserDiscountCouponColumns : BasicColumn[] = [
	{
		title: '金额',
		align: "center",
		dataIndex: 'price'
	},
	{
		title: '过期时间',
		align: "center",
		dataIndex: 'expirationTime'
	},
	{
		title: '券',
		align: "center",
		dataIndex: 'couponId_dictText'
	},
	{
		title: '使用状态',
		align: "center",
		dataIndex: 'useStatus_dictText'
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId_dictText'
	},
];
//子表表单数据
export const coupleUserDiscountCouponFormSchema : FormSchema[] = [
	// TODO 子表隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
	{
		label: '券',
		field: 'couponId',
		component: 'JSearchSelect',
		componentProps: {
			dict: "couple_discount_coupon,title,id"
		},
	},
];
//子表列表数据
export const coupleAccountChangeRecordColumns : BasicColumn[] = [
	{
		title: '时间',
		align: "center",
		dataIndex: 'createTime'
	},
	{
		title: '用户',
		align: "center",
		dataIndex: 'userId_dictText'
	},
	{
		title: '账变类别',
		align: "center",
		dataIndex: 'recordType_dictText'
	},
	{
		title: '变化金额',
		align: "center",
		sorter: true,
		dataIndex: 'price'
	},
	{
		title: '账变前',
		align: "center",
		sorter: true,
		dataIndex: 'changeFront'
	},
	{
		title: '变化后',
		align: "center",
		sorter: true,
		dataIndex: 'changBack'
	},
	{
		title: '变化状态',
		align: "center",
		dataIndex: 'changeStatus_dictText'
	},
	{
		title: '租户',
		align: "center",
		dataIndex: 'tenantId_dictText'
	},
];
//子表表单数据
export const coupleAccountChangeRecordFormSchema : FormSchema[] = [
	// TODO 子表隐藏字段，目前写死为ID
	{
		label: '',
		field: 'id',
		component: 'Input',
		show: false
	},
];